import {
  BwComPropSetConstValueComEnum,
  BwCustomComPropDataTypeEnum,
  BwCustomComEmitParamDataTypeEnum,
  BwCustomComSlotParamDataTypeEnum,
  BwCustomComSoltTypeEnum,
} from '../../../render/models'
import type {
  BwCustomComEmitInfoModel,
  BwCustomComSlotInfoModel,
  BwCustomComPropInfoModel,
} from '../../../render/models'

/** 组件属性 */
const comAttrs: Array<BwCustomComPropInfoModel> = [
  {
    key: 'class',
    name: 'classNames',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.array,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'modelValue',
    name: '值(v-model)',
    isModel: true,
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.array],
    defaultValueDataType: BwCustomComPropDataTypeEnum.array,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'columns-type',
    name: '选项类型',
    isRequire: false,
    defaultValue: JSON.stringify(['hour', 'minute']),
    dataType: [BwCustomComPropDataTypeEnum.array],
    defaultValueDataType: BwCustomComPropDataTypeEnum.array,
    constValueSetCom: BwComPropSetConstValueComEnum.textarea,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'min-hour',
    name: '可选的最小小时',
    isRequire: false,
    defaultValue: '0',
    dataType: [
      BwCustomComPropDataTypeEnum.number,
      BwCustomComPropDataTypeEnum.string,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.number,
    constValueSetCom: BwComPropSetConstValueComEnum.number,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'max-hour',
    name: '可选的最大小时',
    isRequire: false,
    defaultValue: '23',
    dataType: [
      BwCustomComPropDataTypeEnum.number,
      BwCustomComPropDataTypeEnum.string,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.number,
    constValueSetCom: BwComPropSetConstValueComEnum.number,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'min-minute',
    name: '可选的最小分钟',
    isRequire: false,
    defaultValue: '0',
    dataType: [
      BwCustomComPropDataTypeEnum.number,
      BwCustomComPropDataTypeEnum.string,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.number,
    constValueSetCom: BwComPropSetConstValueComEnum.number,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'max-minute',
    name: '可选的最大分钟',
    isRequire: false,
    defaultValue: '59',
    dataType: [
      BwCustomComPropDataTypeEnum.number,
      BwCustomComPropDataTypeEnum.string,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.number,
    constValueSetCom: BwComPropSetConstValueComEnum.number,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'min-second',
    name: '可选的最小秒数',
    isRequire: false,
    defaultValue: '0',
    dataType: [
      BwCustomComPropDataTypeEnum.number,
      BwCustomComPropDataTypeEnum.string,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.number,
    constValueSetCom: BwComPropSetConstValueComEnum.number,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'max-second',
    name: '可选的最大秒数',
    isRequire: false,
    defaultValue: '59',
    dataType: [
      BwCustomComPropDataTypeEnum.number,
      BwCustomComPropDataTypeEnum.string,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.number,
    constValueSetCom: BwComPropSetConstValueComEnum.number,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'min-time',
    name: '可选的最小时间',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'max-time',
    name: '可选的最大时间',
    isRequire: false,
    defaultValue: undefined,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'title',
    name: '顶部栏标题',
    isRequire: false,
    defaultValue: '',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'confirm-button-text',
    name: '确认按钮文字',
    isRequire: false,
    defaultValue: '确认',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'cancel-button-text',
    name: '取消按钮文字',
    isRequire: false,
    defaultValue: '取消',
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'show-toolbar',
    name: '是否显示顶部栏',
    isRequire: false,
    defaultValue: 'true',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'loading',
    name: '是否显示加载状态',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'readonly',
    name: '是否只读',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  // {
  //   key: 'filter',
  //   name: '选项过滤函数',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.function],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.function,
  //   constValueSetCom: BwComPropSetConstValueComEnum.function,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  // {
  //   key: 'formatter',
  //   name: '选项格式化函数',
  //   isRequire: false,
  //   defaultValue: undefined,
  //   dataType: [BwCustomComPropDataTypeEnum.function],
  //   defaultValueDataType: BwCustomComPropDataTypeEnum.function,
  //   constValueSetCom: BwComPropSetConstValueComEnum.function,
  //   constValueSetComProps: null,
  //   remark: '',
  // },
  {
    key: 'option-height',
    name: '选项高度',
    isRequire: false,
    defaultValue: '44',
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.number,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'visible-option-num',
    name: '可见的选项个数',
    isRequire: false,
    defaultValue: '6',
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.number,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'swipe-duration',
    name: '快速滑动时惯性滚动的时长',
    isRequire: false,
    defaultValue: '1000',
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.number,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
]

/** 组件事件 */
const comEmits: Array<BwCustomComEmitInfoModel> = [
  {
    key: 'update:modelValue',
    name: '值变化时触发',
    isModel: true,
    params: [
      {
        paramKey: 'value',
        paramName: '值',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
    ],
  },
  {
    key: 'confirm',
    name: '点击完成按钮时触发',
    params: [
      {
        paramKey: 'selectedValues',
        paramName: 'selectedValues',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
      {
        paramKey: 'selectedOptions',
        paramName: 'selectedOptions',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
      {
        paramKey: 'selectedIndexes',
        paramName: 'selectedIndexes',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
    ],
  },
  {
    key: 'cancel',
    name: '点击取消按钮时触发',
    params: [
      {
        paramKey: 'selectedValues',
        paramName: 'selectedValues',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
      {
        paramKey: 'selectedOptions',
        paramName: 'selectedOptions',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
      {
        paramKey: 'selectedIndexes',
        paramName: 'selectedIndexes',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
    ],
  },
  {
    key: 'change',
    name: '选项改变时触发',
    params: [
      {
        paramKey: 'selectedValues',
        paramName: 'selectedValues',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
      {
        paramKey: 'selectedOptions',
        paramName: 'selectedOptions',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
      {
        paramKey: 'selectedIndexes',
        paramName: 'selectedIndexes',
        paramDataType: BwCustomComEmitParamDataTypeEnum.array,
        remark: '',
      },
      {
        paramKey: 'columnIndex',
        paramName: 'columnIndex',
        paramDataType: BwCustomComEmitParamDataTypeEnum.number,
        remark: '',
      },
    ],
  },
]

/** 组件插槽 */
const comSlots: Array<BwCustomComSlotInfoModel> = [
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'toolbar',
      slotName: '自定义整个顶部栏的内容插槽',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'title',
      slotName: '自定义标题内容插槽',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'confirm',
      slotName: '自定义确认按钮内容插槽',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'cancel',
      slotName: '自定义取消按钮内容插槽',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'option',
      slotName: '自定义选项内容插槽',
      slotParams: [
        {
          paramKey: 'option',
          paramName: '选项',
          paramDataType: BwCustomComSlotParamDataTypeEnum.object,
          remark: '',
        },
        {
          paramKey: 'index',
          paramName: '选项下标',
          paramDataType: BwCustomComSlotParamDataTypeEnum.number,
          remark: '',
        },
      ],
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'columns-top',
      slotName: '自定义选项上方内容插槽',
    },
  },
  {
    slotType: BwCustomComSoltTypeEnum.convention,
    conventionSlotInfo: {
      slotCode: 'columns-bottom',
      slotName: '自定义选项下方内容插槽',
    },
  },
]

export const vantTimeInfo = {
  comAttrs,
  comEmits,
  comSlots,
}
